<?php
class ChambersModel extends BaseModel implements Model {
    function __construct() {
        parent::__construct("chambers", "chamber_id");
        $this->addField("chamber_id", Model::TYPE_INT, Model::MOD_PRIMARY);
        $this->addField("name", Model::TYPE_VARCHAR);
        $this->addField("contact", Model::TYPE_VARCHAR);
        $this->addField("email", Model::TYPE_VARCHAR);
    }

    public function deleteByIdList($idlist) {
        $query = "DELETE FROM chambers WHERE chamber_id IN (" . implode(",", $idlist) . ")";
        Database::executeQuery($query);
    }

    public function renderAlias($record) {
        $result = $record;
        return $result;
    }

    public function isAuthorized($operation, $subject = "") {
        return true;
//        if (Auth::isAdmin()) { return true; }
/*
        switch ($operation) {
            case "update" :
            case "delete" :
            case "addnew" : {
                if (Auth::canChangeDrivers()) { return true; }
            }
            case "list" : {
                if (Auth::canListDrivers()) { return true; }
            }
        }
        return false;
*/
    }

    public function modifyDatabaseInput($data) {
        return $data;
    }
}

?>
